package com.gzsxy.rabbitmq.producer;

import java.util.Arrays;

/**
 * @Description: TODO
 * @Author: xiaolong
 * @date: 2023/2/15 21:10
 * @Version: 1.0
 */
public final class ConstantKey {

    public final static int CODE_200 = 200;
    public final static int CODE_400 = 400;

    public final static int NUMBER_0 = 0;
    public final static int NUMBER_1 = 1;
    public final static int NUMBER_2 = 2;
    public final static int NUMBER_3 = 3;
    public final static int NUMBER_4 = 4;
    public final static int NUMBER_5 = 5;
    public final static int NUMBER_6 = 6;

    /**
     * 消息发送状态
     */
    public enum sendMsgStatus{
        SEND("发送中","0"),
        FAIL("发送失败", "1"),
        SUCCESS("发送成功","2");
        private String name;

        private String value;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        sendMsgStatus(String name, String value) {
            this.name = name;
            this.value = value;
        }

        public static sendMsgStatus getNameByValue(String value){
            return Arrays.stream(sendMsgStatus.values())
                    .filter(s -> s.getValue().equals(value))
                    .findFirst()
                    .orElse(null);
        }

        public static sendMsgStatus getValueByName(String name){
            return Arrays.stream(sendMsgStatus.values())
                    .filter(s -> s.getName().equals(name))
                    .findFirst()
                    .orElse(null);
        }

    }
}
